/**
 * Created by Administrator on 2017/3/21.
 */
import React, {Component,Fragment} from 'react';
import {
  Form, Input, Radio, Select, Icon,
  DatePicker, TreeSelect, Divider, Descriptions,
} from 'antd';
import {connect} from 'dva';
import moment from 'moment'
import request from '@/utils/request';
const FormItem = Form.Item;
const { TextArea } = Input;
const RadioGroup = Radio.Group;
const Option = Select.Option;
const TreeNode = TreeSelect.TreeNode;
@connect(({ inner_address_book, loading, global }) => ({
  inner_address_book,
  global,
  loading: loading.models.inner_address_book,
}))
class AddPoliciesForm extends Component {
  constructor(props) {
    super(props);
    this.state = {
      fileList:[]
    };
  }

  componentDidMount() {
  }
  render() {
    const {
      inner_address_book: { organizationData,loading, tableY, meta, searchParams, selectedRowKeys },
    } = this.props;
    const formItemLayoutWithLabel = {
      labelCol: {
        xs: {span: 24},
        sm: {span: 6},
      },
      wrapperCol: {
        xs: {span: 24},
        sm: {span: 15},
      }
    };

    const {getFieldDecorator} = this.props.form;
    return (
      <div>
        <Form onSubmit={this.handleSubmit}>
          {
            this.props.editRecord.status===1&&
              <Fragment>
                <FormItem
                  {...formItemLayoutWithLabel}
                  label={(
                    <span>
               转正日期
            </span>
                  )}
                >
                  {getFieldDecorator('regularization_date', {
                    initialValue: moment(),
                  })(
                    <DatePicker allowClear={false} style={{width:'100%'}}/>
                  )}
                </FormItem>
                <FormItem
                  {...formItemLayoutWithLabel}
                  label={(
                    <span>
               转正备注
            </span>
                  )}
                >
                  {getFieldDecorator('regularization_remark', {
                    initialValue: this.props.editRecord?this.props.editRecord.regularization_remark:'',
                  })(
                    <Input />
                  )}
                </FormItem>
              </Fragment>
          }
          {
            this.props.editRecord.status===2&&
            <Fragment>
              <FormItem
                {...formItemLayoutWithLabel}
                label={(
                  <span>
               离职日期
            </span>
                )}
              >
                {getFieldDecorator('resignation_date', {
                  initialValue: moment(),
                })(
                  <DatePicker allowClear={false} style={{width:'100%'}}/>
                )}
              </FormItem>
              <FormItem
                {...formItemLayoutWithLabel}
                label={(
                  <span>
               离职原因
            </span>
                )}
              >
                {getFieldDecorator('resignation_reason', {
                  initialValue: this.props.editRecord?this.props.editRecord.resignation_reason:'',
                })(
                  <Input />
                )}
              </FormItem>
              <FormItem
                {...formItemLayoutWithLabel}
                label={(
                  <span>
               离职备注
            </span>
                )}
              >
                {getFieldDecorator('resignation_remark', {
                  initialValue: this.props.editRecord?this.props.editRecord.resignation_remark:'',
                })(
                  <Input />
                )}
              </FormItem>
            </Fragment>
          }
        </Form>
      </div>
    );
  }
}

const AddPoliciesFormWrap = Form.create()(AddPoliciesForm);
export default AddPoliciesFormWrap;


